<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php");
	include("function/function.php");
	
	$classid = chkstr(trim($_REQUEST['classid']));
	if(is_numeric($classid)){
	
		$sql="select * from kboy_bigclass where id=$classid";
		$rows=mysql_query($sql);
		$nums=mysql_num_rows($rows);
		if($nums>0){
			$rs=mysql_fetch_array($rows);
			$bigclass_cn = $rs['bigclass_cn'];
		}else{
			echo erro("该信息不存在或已被删除1");
		}
	}else{
		echo erro("参数错误");
	}
	
	
	// 获取父ID串
	$replace_str = "1,2,3";
	getFatherID($classid,"");
	$getFatherID = $getFatherID . ",";
	$EXarr = explode(',',$replace_str);
	foreach($EXarr as $u){
		$rep_str = ','.$u.",";
		$getFatherID = str_replace($rep_str,'',$getFatherID);
	}
	$getFatherID = rtrim(ltrim($getFatherID,','),',');
	if(strlen($getFatherID)>0){
		$Farr = array_reverse(explode(",",$getFatherID));
		$FarrNum = $Farr[0];
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?= $bigclass_cn ?>_<?= $web_titles?></title>
<meta name="Keywords" content="<?= $bigclass_cn ?>,<?= $web_keywords ?>" />
<meta name="Description" content="<?= $web_description ?>" />
<link rel="stylesheet" type="text/css" href="css/common.css" />
<link rel="stylesheet" type="text/css" href="css/zixun.css" />
<script type="text/javascript" src="js/baidutongji.js"></script>
</head>
<body>
    <!--top-bar begin-->
	<? include("_include.top.topbar.php") ?>
    <!--top-bar end-->
    <!--header begin-->
	<? include("_include.top.navbar.php") ?>
    <!--header end-->
  <!-- 主体内容 begin-->
  <div class="l-container-wrap">
    <div class="content">
	  <? include("_include.news.banners.php") ?>
      <div class="l-main">
        <div class="l-main-nav">
          <div class="l-nav">
            <div class="l-nav-left">
              <ul>
                <li class="l-about-news <? if($classid == 6){ echo "on";}?>"><a href="news.php?classid=6" title=""><?php echo getClassName("kboy_bigclass", "bigclass_cn","id = 6") ?></a></li>
                <li class="l-about-news <? if($classid == 7 || $classid == 61 || $classid == 62 || $classid == 63){ echo "on";}?>"><a href="outdoor.php?classid=7" title=""><?php echo getClassName("kboy_bigclass", "bigclass_cn","id = 7") ?></a></li>
                <li class="l-about-news <? if($classid == 8){ echo "on";}?>"><a href="news.php?classid=8" title=""><?php echo getClassName("kboy_bigclass", "bigclass_cn","id = 8") ?></a></li>
                <li class="l-about-title <? if($classid == 9 || $classid == 64 || $classid == 65 || $classid == 66){ echo "on";}?>"><a href="zhuanti.php?classid=65" title=""><?php echo getClassName("kboy_bigclass", "bigclass_cn","id = 65") ?></a></li>
              </ul>            
            </div>
            <div class="l-nav-right">
              <ul class="ul2">
                <li>当前位置：&gt</li>
                <li><a href="index.php" title="">首页</a></li>
                <li class="name-change">&gt<?=$bigclass_cn?></li>
              </ul>
            </div>
          </div>
        </div>
        <!-- 热门新闻 户外知识 CVA新闻 的内容  这三个在 l-main-content 中tab切换-->
        <div class="l-main-content show">
          <div class="l-bd c">
            <div class="l-bd-left">
              <div class="l-hotnews l-news-qiehuan show">
                <div class="left-content">
                  <div class="news-top">
                    <div class="top-title">
                      <h2>新闻头条</h2>
                    </div>
                    <div class="top-main c">
                      <div class="left">
                        <div class="left-top">
                          <div id="l-slideBox" class="l-slideBox">
                            <div class="hd">
                              <ul>
							  <?php
							  		$IDs = "";
							  		$N_ClassID = $classid;
									$news_sql = "select * from kboy_news where news_bigclass=$N_ClassID and news_pic!='' order by news_top desc,news_order desc, id desc limit 5";
									$news_rows = mysql_query($news_sql);
									while($news_rs = mysql_fetch_array($news_rows)){
										echo "<li></li>";
									}
							  ?>
							  </ul>
                            </div>
                            <div class="bd">
                              <ul>
							  <?php
									$news_sql = "select * from kboy_news where news_bigclass=$N_ClassID and news_pic!='' order by news_top desc,news_order desc, id desc limit 5";
									$news_rows = mysql_query($news_sql);
									while($news_rs = mysql_fetch_array($news_rows)){
										echo "<li><a href=\"newsview.php?newsid=".$news_rs['id']."\" target=\"_blank\"><img src=\"".$news_rs['news_pic']."\" /><p>".$news_rs['news_title']."</p></a></li>";
									$IDs = $IDs . "," .$news_rs['id'];
									}
									$IDs = rtrim(ltrim($IDs,','),',');
							  ?>
                              </ul>
                            </div>
                          </div>
                        </div>
                        <div class="left-bottom">
                          <ul>
						  	<?php
									if($IDs){
										$news_sql = "select * from kboy_news where news_bigclass=$N_ClassID and news_pic!='' and id not in(".$IDs.") order by news_top desc,news_order desc, id desc limit 2";
										$news_rows = mysql_query($news_sql);
										while($news_rs = mysql_fetch_array($news_rows)){
											echo "<li><a href=\"newsview.php?newsid=".$news_rs['id']."\" target=\"_blank\"><img src=\"".$news_rs['news_pic']."\" /><p>".$news_rs['news_title']."</p></a></li>";
										$IDs = $IDs . "," .$news_rs['id'];
										}
										$IDs = rtrim(ltrim($IDs,','),',');
									}
							?>
                          </ul>
                        </div>
                      </div>
                      <div class="right">
							<?php
									if($IDs){
										$news_sql = "select * from kboy_news where news_bigclass=$N_ClassID and id not in(".$IDs.") order by news_top desc,news_order desc, id desc limit 4";
									}else{
										$news_sql = "select * from kboy_news where news_bigclass=$N_ClassID order by news_top desc,news_order desc, id desc limit 4";
									}
									$news_rows = mysql_query($news_sql);
									while($news_rs = mysql_fetch_array($news_rows)){
							?>
									<div class="cell">
									  <div class="cell-title">
										<h2><a href="newsview.php?newsid=<?=$news_rs['id']?>" target="_blank"><?=getTitleStyle("kboy_news",$news_rs['id'],$news_rs['news_title'],25)?></a></h2>
									  </div>
									  <div class="cell-content">
										<p><?=cutstr($news_rs['news_text'],50)?><a href="newsview.php?newsid=<?=$news_rs['id']?>" target="_blank">[详情]</a></p>
									  </div>
									  <div class="cell-foot c">
										<span><?=date('Y-m-d',strtotime($news_rs['news_addtime']))?></span>
										<ul>
										  <li class="li1"><a href="newsview.php?newsid=<?=$news_rs['id']?>" title=""><img src="images/l-con1.png" alt=""><?=$news_rs['news_hit']?></a></li>
										
										</ul>
									  </div>
									</div>
							<?php
									$IDs = $IDs . "," .$news_rs['id'];
									}
									$IDs = rtrim(ltrim($IDs,','),',');
							?>
                      </div>
                    </div>
                  </div>
                  <div class="news-img">
				  	<?=getBanners(68)?>
                  </div>
                  <div class="news-bottom">
                    <div class="bottom-title">
                      <h2>最新新闻</h2>
                    </div>
                    <div class="bottom-main">
					
						<?php
								$SQL = "";
								if($IDs != ""){
									if($SQL != ""){
										$SQL = $SQL." and id not in($IDs)";
									}else{
										$SQL = " id not in($IDs)";
									}
								}
								$pagesize = 10; // 分页数量
								$pageval = chkstr(trim($_REQUEST['page'])); // 获取Page的值
								if($pageval){
									if(!is_numeric($pageval)){
										echo erro("Page Error");
									}
									if($pageval <= 1){
										$pageval = 1;
									}
									$page = ($pageval-1) * $pagesize;
									$page .= ",";
								}else{
									$pageval = 1;
								}
								
								if($SQL != ""){
									$pagesql = "select * from kboy_news where ".$SQL." and news_bigclass=$classid order by news_top desc,news_order desc, id desc";
								}else{
									$pagesql = "select * from kboy_news where news_bigclass=$classid order by news_top desc,news_order desc, id desc";
								}

								$pagenum = mysql_num_rows(mysql_query($pagesql)); // 总记录数
								$pagecount = ceil($pagenum/$pagesize); // 共分多少页
								if($pageval > $pagecount){
									$pageval = $pagecount;
								}
								
								$news_sql = $pagesql." limit $page $pagesize";
								$news_rows = mysql_query($news_sql);
								$i = 1;
								while($news_rs = mysql_fetch_array($news_rows)){
						?>
							  <div class="cell">
								<div class="cell-title">
								  <h2><a href="newsview.php?newsid=<?=$news_rs['id']?>" target="_balnk"><?=getTitleStyle("kboy_news",$news_rs['id'],$news_rs['news_title'],25)?></a></a> <span><?=date('Y-m-d',strtotime($news_rs['news_addtime']))?></span></h2>
								</div>
								<div class="cell-main c">
								  <div class="left">
									<a href="newsview.php?newsid=<?=$news_rs['id']?>" target="_balnk"><img src="<?=$news_rs['news_pic']?>" alt=""></a>
								  </div>
								  <div class="right">
									<div class="right-main">
									  <p><?=cutstr($news_rs['news_text'],50)?><a href="newsview.php?newsid=<?=$news_rs['id']?>" target="_blank">[详情]</a></p>
									</div>
									<div class="right-foot c">
									  <span>来源于：<?=$news_rs['news_from']?></span>
									  <ul>
										<li class="li1"><a href="newsview.php?newsid=<?=$news_rs['id']?>" title=""><img src="images/l-con1.png" alt=""><?=$news_rs['news_hit']?></a></li>
										
									  </ul>
									</div>
								  </div>
								</div>
							  </div>
						<?php
								} // while 完毕
						?>

                    </div>
                    <div class="bottom-foot">
						<?php
								if($pagenum > $pagesize){
									echo "<div class=\"pagination\"><ul>";
									$url = "news.php?classid=$classid";//当前页面
									pagebar($pagecount, $pageval, 7, $url);
									echo "</ul></div>";
								}
						?>
                    </div>
                  </div>
                </div>
              </div>
            </div>
			
			
			<? include("_include.news.rightbar.php") ?>
			
			
          </div>
        </div>
        <!-- 热门新闻 户外知识 CVA新闻 的内容  这三个在 l-main-content 中tab切换  end-->
      </div>
    </div>
  </div>
  <!-- 主体内容 end-->
	<!--foot begin-->
	<? include("_include.bottom.footbar.php") ?>
	<!--foot begin-->
	<!--左侧悬浮 begin-->
	<? include("_include.bottom.leftbar.php") ?>
	<!--左侧悬浮 end-->
	<!--右侧悬浮导航 begin-->
	<? include("_include.bottom.rightbar.php") ?>
	<!--右侧悬浮导航 end-->
<script type="text/javascript" src="js/jquery-1.10.2.min.js" ></script>
<script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
<script type="text/javascript" src="js/main.js" ></script>
<script type="text/javascript" src="js/zixun.js" ></script>
</body>
</html>